package com.git_taoxian_test1;


import java.util.Scanner;

public class Test {
    Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        Student stu = new Student();
        try{
            setSex(stu);
        }catch (SexException sexException){
            sexException.printStackTrace();
        }
        try{
            setAge(stu);
        }catch (AgeException ageException){
            ageException.printStackTrace();
        }
    }
//   设置性别赋值方法
    public static void setSex(Student stu){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入性别:");
        String newSex = sc.next();
        stu.setGender(newSex);
    }
//    设置年龄赋值方法
    public static void setAge(Student stu){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入年龄:");
        int newAge = sc.nextInt();
        stu.setAge(newAge);
    }
}
